<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Generador de código para Glade -->
<xsl:template match="/">
<xsl:variable name="program">glade</xsl:variable>
/* Generado automáticamente con glade.xsl */
/* <xsl:value-of select="$program"/> */

#include &lt;gtk/gtk.h&gt;
 
<xsl:for-each select="//signal">
void
<xsl:value-of select="@handler"/> (foo, bar)
{
  /* poner código aquí */
}
</xsl:for-each>
 
int main (int argc, char *argv[])
{
  GtkBuilder *builder;
  <xsl:for-each select="//object">
  <xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
  <xsl:for-each select="//object[@id=$id]/signal">
  GtkWidget *<xsl:value-of select="$id"/>;</xsl:for-each>
  </xsl:for-each>

  gtk_init (&amp;argc, &amp;argv);

  builder = gtk_builder_new ("<xsl:value-of select="$program"/>.glade", NULL);

  <xsl:for-each select="//object">
  <xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
  <xsl:for-each select="//object[@id=$id]/signal">
  <xsl:value-of select="$id"/> = gtk_builder_get (builder, "<xsl:value-of select="$id"/>");
  </xsl:for-each>
  </xsl:for-each>

  <xsl:for-each select="//object">
  <xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
  <xsl:for-each select="//object[@id=$id]/signal">
  g_signal_connect (<xsl:value-of select="$id"/>, "<xsl:value-of select="@name"/>", G_CALLBACK (<xsl:value-of select="@handler"/>));</xsl:for-each>
  </xsl:for-each>

  <xsl:for-each select="//object[@class='GtkWindow']">

  gtk_widget_show (<xsl:value-of select="@id"/>);
  </xsl:for-each>
  gtk_main ();
}
</xsl:template>

</xsl:stylesheet>
